<template>
	<el-card style="height: 100%;">
		
<el-button @click="add()" type="success" class="el-icon-plus" style="margin: 20px;">新增</el-button>

  <el-table
    :data="tableData"
    border
    >
    <el-table-column
      prop="update_time"
      label="开始时间">
    </el-table-column>

    <el-table-column
      prop="name"
      label="试卷名"
      >
    </el-table-column>

    <el-table-column
      prop="create_time"
      label="结束时间"
      >
    </el-table-column>
    <el-table-column
      prop="coures.name"
      label="科目"
     >
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      >
      <template slot-scope="scope">
        <el-button @click="deletea(scope.row)" type="text" size="small">删除</el-button>

      </template>
    </el-table-column>
  </el-table>
  </el-card>
</template>

<script>
  export default {
    data() {
      return {
       scrollHeight:'0px',
        tableData: [{
        }]
      }
    },
    methods: {
      deletea(row) {
		   /* console.log(row) */
		     this.$ajax.post('Shijuan/delete',{"id":row.id}).then(res=>{
			    if(res.data.success){
				      this.getList()
			     }
			  })
      },
	  add(){
		  this.$router.replace('/teacher/sjbianji')
	  },

	  tjst(row){
		   this.$router.push('/exam/mainst?row='+row.id)
	  },
	  getList(){
		  	this.$ajax.post('Shijuan/page',{}).then(res=>{
		  	  var result=res.data;
		  	  this.tableData=result.data.rows;
		  	  console.log(this.tableData);
		  	})

	  }
    },
  mounted(){
        this.scrollHeight = window.innerHeight*0.84 + 'px';
    },

	created() {
		this.getList()
	},
	tableAttrs: {
	  border: true
	},
  }
</script>

<style>
</style>
